﻿namespace ProblemsSet
{
    public class Problem_160 : BaseProblem
    {
        public override object GetResult()
        {
            ulong cnt = 1000000000000;
            ulong res = 1;
            ulong kf = 1;

            for (ulong l = 2; l < cnt; l++)
            {

                kf = l;
                while (kf % 10 == 0)
                {
                    kf /= 10;
                }
                kf %= 1000000;
                res *= kf;
                while (res % 10 == 0)
                {
                    res /= 10;
                }
                res %= 1000000;
            }
            return res;
        }

        public override string Problem
        {
            get
            {
                return @"For any N, let f(N) be the last five digits before the trailing zeroes in N!.
For example,

9! = 362880 so f(9)=36288
10! = 3628800 so f(10)=36288
20! = 2432902008176640000 so f(20)=17664

Find f(1,000,000,000,000)";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return false;
            }
        }

        public override object Answer
        {
            get
            {
                return null;
            }
        }

    }
}
